﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace NHOMA2_DVLH.Controls
{
    public partial class KhungDangNhap : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Login_LoggedIn(object sender, EventArgs e)
        {
            String username = Login.UserName;
            Response.Write("<script language='javascript'>alert('User : " + username + " .');</script>");
            if (Roles.IsUserInRole(username, "DH"))
            {
                Response.Redirect("~/NhanVienDieuHanh/Default.aspx");
            }
            else if (Roles.IsUserInRole(username, "NV"))
            {
                Response.Redirect("~/NhanVienTram/Default.aspx");
            }
            else if (Roles.IsUserInRole(username, "TX"))
            {
                Response.Redirect("~/TaiXe/Default.aspx");
            }            
        }

        protected void Login_LoginError(object sender, EventArgs e)
        {
            Response.Write("<script language='javascript'>alert('Account isnot exist. Try again');</script>");
        }
    }
}